﻿@model PessModel.Archive

@{
    ViewBag.Title = "Cancel";
}

<h2>Cancel Proposal</h2>


<div id="operate">
    @Html.ActionLink("Back to My Proposals", "Proposals")
</div>

<fieldset class="show">
    <legend>Cancel this proposal?&#8195;</legend>
    <div class="heading" >
        Proposal Information
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.CalculatedSerialNumber)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.CalculatedSerialNumber)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.ProjectTitle)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.ProjectTitle)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.CountyCode)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.County.Name)
    </div>

    <div class="display-label">
        @*@Html.DisplayNameFor(model => model.Subject.TrackID)*@Track
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Subject.Track.Title)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.SubjectID)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Subject.Name)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.SchoolComment)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.SchoolComment)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.CountyEBComment)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.CountyEBComment)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.PrimaryKeyword)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.PrimaryKeyword)
    </div>

    <div class="display-label">
        @Html.DisplayNameFor(model => model.SecondaryKeyword)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.SecondaryKeyword)
    </div>
    
</fieldset>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    <div class="del_btn" style="clear:both;float:none;margin-left:200px;">        
        <input type="submit" value="Delete" />&#8195;@Html.ActionLink("Back", "Proposals")
    </div>
    }

<div id="dialog-message" title="Message">
    <p>
        <span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;">Message</span>
        <span id="msg_in_dialog"></span>
    </p>
</div>

<script type="text/javascript">
          $(document).ready(function () {

         $("#dialog-message").hide();

          $("form").submit(function (event) {
              event.preventDefault();
              $(this).validate().defaultShowErrors();
              if ($(this).valid()) {
                  // Show the "busy" Gif:
                  $('#msg_in_dialog').html("Processing...<br/><br/><img src='@Url.Content("~/images/ajax-loader.gif")'>");
                  $("#dialog-message").dialog({
                      modal: true
                  });

                  var url = $(this).attr("action");
                  var formData = $(this).serialize();
                  $.ajax({
                      url: url,
                      type: "POST",
                      data: formData,
                      dataType: "json",
                      success: function (url) {
                          // Hide the "busy" gif:
                          $('#msg_in_dialog').html("Changes saved.");
                          $("#dialog-message").dialog({
                              modal: true,
                              buttons: {
                                  "OK": function () {
                                      window.location.href = url;
                                      $(this).dialog("close");

                                  }
                              }
                          });
                          // Do something useful with the data:
                      }
                  })
              }
              else
              {
                  //$(".error").show();
                  //$('#msg_in_dialog').html("Please complete all the fields.");
                  //$("#dialog-message").dialog({
                  //    modal: true,
                  //    buttons: {
                  //        "Close": function () {
                  //            $(this).dialog("close");
                  //        }
                  //    }
                  //});
              }
          });

  });

</script>
